<?php
//=========================
//Vuong Van Binh
//Wanbin@vietnambiz.com
//list & add cat faq
//=========================
include ADMIN_INCLUDE_DIR."/header.php";

add_new_document_category();
edit_document_category();
del_document_faq();
del_multi_cat();

$cat_faq_edit = get_cat_faq_edit();
?>
<div class="container_l">
		<div class="title_user"><img src="images/icon1.gif" />All FAQs - Categories</div>
		<div class="table_user">
			<div class="table_user_in">
			
				<form name="add_cat" method="post" action="">
				<fieldset>
				<?php 
					show_error(); 
					show_success(); 
				?>
					<legend accesskey="N"><?php if($cat_faq_edit){ echo "Edit Categoty <<<a href='index.php?module=faq&option=category'>Add New</a>>>"; }else{ echo "Add New Category";} ?></legend>
					<div class="lineaddnew" style="margin-top:0px;">
						<div class="lineform">
							<div class="divlabel"><strong>Category name:</strong></div>
							<div class="divform" style="width:400px;padding:0px"><input type="text" name="cat_name" value="<?php echo htmlentities_utf8($cat_faq_edit["cat_name"]);?>" id="cat_name" style="width:96%" /></div>
							<div style="float:left; display:inline; margin-top:2px;">
							<?php if($cat_faq_edit){ ?>
								<input type="hidden" name="cat_edit_id" value="<?php echo $cat_faq_edit["cat_id"];?>" />
								<input type="submit" name="edit_cat" value="Save Change" class="button" id="edit_Cat"/>
							<?php }else{ ?>
								<input type="submit" name="add_new_cat" value="Add New Category" class="button" id="add_New_Cat"/>
							<?php } ?>	
							</div>
						</div>
						
					</div>
			
				</fieldset>
				</form>
				<form name="del_check" action="" method="post" id="form_del_check">
				<div class="boxtitle">
					<div class="d_input" style="width:3%;"><input type="checkbox" name="checkall" id="checkall" value="" /></div>
					<div class="d_user" style="width:43%; text-align:left">&nbsp;&nbsp;Category Name</div>
					<div class="d_fullname" style="width:40%; text-align:left">&nbsp;&nbsp;Category Name_link</div>
					<div class="d_setting" style="width:13%;">Setting</div>
				</div>
				
				<?php
				      $rs = get_all_cat_document();
					  
					  if($db->num_rows($rs) > 0){
					  
						while($cat_faq=$db->fetch_array($rs)){
						
				?>
				
						<div class="lineuser">
							<div class="d_input2" style="width:3%;"><input type="checkbox" name="check[]" id="check" class="check" value="<?php echo $cat_faq["cat_id"]; ?>" /></div>
							<div class="d_user2" style="width:43%;text-align:left"><font class="textbody"><a href="#"><?php echo $cat_faq["cat_name"]; ?></a></font></div>
							<div class="d_fullname2" style="width:40%; text-transform:capitalize; text-align:left"><font class="textbody"><?php echo $cat_faq["cat_name_link"]; ?></font></div>
							<div class="d_setting2" style="width:13%;">
							<a href="index.php?module=faq&option=category&edit=<?php echo $cat_faq["cat_id"]; ?>"><img src="images/edit.gif" alt="Edit" title="Edit" /></a>
							<a onclick="confirm_get('Are you sure to delete : <b><?php echo replace_quot($cat_faq["cat_name"]); ?></b> ?','index.php?module=faq&option=category&del=<?php echo $cat_faq["cat_id"]; ?>');" href="javascript:void(0);"><img src="images/delete.gif" alt="Delete" title="Delete" /></a></div>
						</div>
				
				<?php
				      }  }else{ echo "<font color=red> No Faq...</font>";}
				?>
				
				<div class="boxbutton">
				    <input type="hidden" name="del_multi" value="okie" />
 					<input type="button" value="Delete checked" class="button" onclick="confirm_post('Are you sure to delete all checked','form_del_check');" />
					<input type="button" name="delete" value="Cancel" class="button" id="cancel"/>
				</div>
				</form>
				
				
			</div>
		</div>
			
</div>
<?php
include "inc/right.php"; 
include ADMIN_INCLUDE_DIR."/footer.php"; 
?>